﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Reflection;

namespace DistributeTransaction.Utils
{
    public class AcceptSubmitTypeAttribute : ActionMethodSelectorAttribute
    {
        public string Name { get; set; }
        public string Type { get; set; }

        public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)
        {
            return controllerContext.RequestContext.HttpContext
                .Request.Form[this.Name] == this.Type;
        }
    }
}